package com.giventime.stormcoming.renderers;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.giventime.stormcoming.StormComing;
import com.giventime.stormcoming.dungeon.CellContent;
import com.giventime.stormcoming.dungeon.StormDungeonCell;

public class StormDungeonCellRenderer extends Renderer<StormDungeonCell> {
	
	private BitmapFont font = new BitmapFont();
	
	@Override
	public void render(SpriteBatch batch, StormDungeonCell cell) {
		batch.begin();
		displayInfo(batch);
		if (!cell.isEmpty()) {			
			for (CellContent content : cell.getCellContent()) {						
				if (content instanceof Renderable) {
					((Renderable) content).render(batch);
				}
			}					
		}
		batch.end();
	}
	
	/**
	 * 
	 * @param batch
	 */
	private void displayInfo(SpriteBatch batch) {
		int i = 0;
		for (String message : StormComing.GAME_MESSAGES) {
			font.draw(batch, message, 400, 60-i);
			i += 20;
		}		
	}
	
}
